// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.util;

public class Type {
    public static <R, I> R tryCastTo(I object, Class<R> _class) {
        return (R)(_class.isInstance(object) ? _class.cast(object) : null);
    }

    public static boolean asBoolean(Object val) {
        return asBoolean(val, false);
    }

    public static boolean asBoolean(Object val, boolean defaultVal) {
        if (val == null) {
            return defaultVal;
        } else {
            Boolean _boolean = tryCastTo(val, Boolean.class);
            return _boolean == null ? defaultVal : _boolean;
        }
    }
}
